package com.ugoodtech.mdcc.core.repository;

import com.ugoodtech.mdcc.core.domain.StationPaintReport;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface StationPaintReportRepository extends PagingAndSortingRepository<StationPaintReport, Long>
        , QueryDslPredicateExecutor<StationPaintReport> {

    @Query("from StationPaintReport where question_id=:question_id and report_id=:report_id")
    StationPaintReport selectAnswer(@Param("question_id") Long question_id, @Param("report_id") Long report_id);

    @Query("from StationPaintReport where report_id=:report_id")
    List<StationPaintReport> selectAnswer(@Param("report_id") Long report_id);

    @Query("from StationPaintReport where report_id=:report_id and question_id=:questionId and deleted=false and enabled=true")
    StationPaintReport selectAnswerByQuestion(@Param("report_id") Long report_id, @Param("questionId") Long questionId);


}
